package com.websocket.controller;

import com.websocket.config.originWebsocket.handler.MyWebSocketHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @作者: 林江
 * @创建时间: 2023/12/18
 * @功能:
 */
@RestController
public class TestController {

//    @Autowired
    MyWebSocketHandler myWebSocketHandler;

    @GetMapping("/sendMsg")
    public String sendMsg(HttpServletRequest request) throws IOException {
        String id = request.getSession().getId();
        myWebSocketHandler.sendMsg(id,"我是你爹");
        return "success";
    }
}
